﻿define('mock/mock.generator',
	['jquery', 'moment', 'activity'],
	function ($, moment) {
		var
			generateWorkspace = function () {
				var mockModel = function () {
					var
						activityArray = [
							new Activity(0, "Studying"),
							new Activity(1, "Research"),
							new Activity(2, "Project 1"),
							new Activity(3, "Reading a books"),
							new Activity(4, "Ololo")],

						rangeArray = [
							{ activity: "Ololo 1", start: "08:10:27", end: "10:55:11", total: "2:44:36" },
							{ activity: "Project", start: "10:55:11", end: "12:55:11", total: "2:00:00" },
							{ activity: "Reading a book", start: "12:55:11", end: "16:20:00", total: "3:44:49" },
							{ activity: "Doing nothing", start: "16:20:00", end: "21:30:00", total: "5:10:00" }],

						activities = ko.observableArray(activityArray),
						timeRanges = ko.observableArray(rangeArray),

						context = ko.computed(function () {
							return {
								date: "Working Day: " + moment().format("MMM Do YYYY"),
								totalTime: "ololo"
							}
						}),

						activityToggle = function (activity) {
							if (activity) {
								var timer = activityArray[activity.id].timer;
								if (timer) {
									if (timer.status == false) {
										timer.start();
										timeRanges.push({ activity: "Project", start: "10:55:11", end: "12:55:11", total: "2:00:00" });
									} else {
										timer.stop();
									}
								}
							}
						},

						addNewActivity = function () {
							activities.push(new Activity(activityArray.length, "Trololo"));
						},

						changeActivityName = function () {
							//window.alert('change name');
						};
				};

				return mockModel;
			};

		return {
			model: {
				generateWorkspace: generateWorkspace
			}
		};
	});